package edu.umd.ion.wavemeter.server;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * class to store the client settings xml in persistent storage
 * @author pmaunz
 *
 */
@SuppressWarnings("serial")
@Entity(name = "ClientSettings")
@Table(name = "ClientSettings")
@NamedQueries({
    @NamedQuery(name="Usernames",
        query="SELECT x FROM ClientSettings x")
})
public class PersistentDisplaySettings implements Serializable, PersistentObject<String,PersistentDisplaySettings> {
	@Column(name = "id", nullable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	private long id;

	@Id //signifies the primary key
	@Column(name="username")
	private String Username;
	
	@Column(name="settings", length=100000)
	private String Settings;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getUsername() {
		return Username;
	}

	public void setUsername(String username) {
		Username = username;
	}

	public String getSettings() {
		return Settings;
	}

	public void setSettings(String settings) {
		Settings = settings;
	}

	@Override
	public String getPrimaryKey() {
		return Username;
	}

	@Override
	public void set(PersistentDisplaySettings data) {
		Settings = data.Settings;
	}

}
